define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'other.protocol/index',
        add_url: 'other.protocol/add',
        edit_url: 'other.protocol/edit',
        delete_url: 'other.protocol/delete',
        export_url: 'other.protocol/export',
        modify_url: 'other.protocol/modify',
        sync: 'other.protocol/sync',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh','add',
                    [{
                        text: '推送',
                        url: init.sync,
                        method: 'request',
                        auth: 'sync',
                        class: 'layui-btn layui-btn-danger layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-full="true"',
                    }],
                ],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '编号'},
                    {field: 'name', title: '标题'},
                    {field: 'create_time', title: '添加时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});